import {request} from "./request";
import da from "element-ui/src/locale/lang/da";


export function getAllOverTime(data) {
  return request({
    url: "/getAllOverTime",
    method: "post",
    params: {
      pageNo: data.pageNo,
      pageSize: data.pageSize
    }
  })
}

export function getMyOverTime(data, id) {
  return request({
    url: "/getMyOverTime",
    method: "post",
    params: {
      pageNo: data.pageNo,
      pageSize: data.pageSize,
      work_id: id
    }
  })
}
export function addOverTime(data) {
  console.log(data)
  return request({
    url: "/addOverTime",
    method: "post",
    params: {
      startTime: data.startTime,
      endTime: data.endTime,
      reason: data.reason,
      departmentId: window.sessionStorage.getItem('departmentId'),
      name: window.sessionStorage.getItem('name'),
      workId: window.sessionStorage.getItem('account')
    }

  })
}

export function editOverTime(data, id) {
  console.log(data)
  return request({
    url: "/editOverTime",
    method: "post",
    params: {
      id: id,
      startTime: data.startTime,
      endTime: data.endTime,
      reason: data.reason,
      departmentId: window.sessionStorage.getItem('departmentId'),
      name: window.sessionStorage.getItem('name'),
      workId: window.sessionStorage.getItem('account')
    }
  })
}


export function delOverTime(id) {
  return request({
    url: "/delOverTime",
    method: "post",
    params: {
      id: id
    }
  })
}

export function approve(id, isAgree) {
  return request({
    url: "/isAgree",
    method: "post",
    params: {
      id: id,
      isAgree: isAgree,
      approver: window.sessionStorage.getItem('name')
    }
  })
}




